﻿//***********************************************************************
// Assembly         : IGolovkine.AoA.Tcp.Channels.Http
// Author           : Ilia
// Created          : 06-11-2011
//
// Last Modified By : Ilia
// Last Modified On : 01-10-2010
// Description      : 
//
// Copyright        : (c) Microsoft. All rights reserved.
//***********************************************************************
using System;
using System.Linq;

namespace IGolovkine.AoA.Tcp.Channels.Http
{
    [Serializable]
    public class HttpEnvelope 
    {
        public static HttpEnvelope Empty = new HttpEnvelope(new Message[0]);

        private readonly Message[] _messages;
        public HttpEnvelope(Message[] messages)
        {
            _messages = messages;
        }

        public Message[] GetMessages()
        {
            return _messages;
        }

        public int GetConnectionDataLength()
        {
            return _messages.OfType<TcpConnectionData>().Sum(m => m.GetData().Length);
        }
    }
}
